home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Dialectic 1.2 / source / Dialectic ƒ / Raw dialects ƒ / morse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  3.1 KB  |  81 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        morse.c
  4.  
  5. Purpose:    This module handles actually converting text into Morse Code.
  6.  
  7.  
  8. Dialectic -=- dialect text conversion extraordinare
  9. Copyright ©1994, Mark Pilgrim
  10.  
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program in a file named "GNU General Public License".
  23. If not, write to the Free Software Foundation, 675 Mass Ave,
  24. Cambridge, MA 02139, USA.
  25.  
  26. \**********************************************************************/
  27.  
  28. #include "dialectic dispatch.h"
  29. #include "dialectic utilities.h"
  30. #include "program globals.h"
  31.  
  32. void ConvertMorse(void)
  33. {
  34.     unsigned char        oneChar;
  35.     
  36.     oneChar=ThisChar()|0x20;
  37.     
  38.     if (ThisChar()=='.')        StoreString("\p.-.-.-");
  39.     else if (ThisChar()==',')    StoreString("\p--..--");
  40.     else if ((ThisChar()==' ') || (ThisChar()==0x0d) || (ThisChar()==0x0a))
  41.                                 StoreChar(ThisChar());
  42.     else if (oneChar=='a')        StoreString("\p.-");
  43.     else if (oneChar=='b')        StoreString("\p-...");
  44.     else if (oneChar=='c')        StoreString("\p-.-.");
  45.     else if (oneChar=='d')        StoreString("\p-..");
  46.     else if (oneChar=='e')        StoreChar('.');
  47.     else if (oneChar=='f')        StoreString("\p..-.");
  48.     else if (oneChar=='g')        StoreString("\p--.");
  49.     else if (oneChar=='h')        StoreString("\p....");
  50.     else if (oneChar=='i')        StoreString("\p..");
  51.     else if (oneChar=='j')        StoreString("\p.---");
  52.     else if (oneChar=='k')        StoreString("\p-.-");
  53.     else if (oneChar=='l')        StoreString("\p.-..");
  54.     else if (oneChar=='m')        StoreString("\p--");
  55.     else if (oneChar=='n')        StoreString("\p-.");
  56.     else if (oneChar=='o')        StoreString("\p---");
  57.     else if (oneChar=='p')        StoreString("\p.--.");
  58.     else if (oneChar=='q')        StoreString("\p--.-");
  59.     else if (oneChar=='r')        StoreString("\p.-.");
  60.     else if (oneChar=='s')        StoreString("\p...");
  61.     else if (oneChar=='t')        StoreChar('-');
  62.     else if (oneChar=='u')        StoreString("\p..-");
  63.     else if (oneChar=='v')        StoreString("\p...-");
  64.     else if (oneChar=='w')        StoreString("\p.--");
  65.     else if (oneChar=='x')        StoreString("\p-..-");
  66.     else if (oneChar=='y')        StoreString("\p-.--");
  67.     else if (oneChar=='z')        StoreString("\p--..");
  68.     else if (oneChar=='0')        StoreString("\p-----");
  69.     else if (oneChar=='1')        StoreString("\p.----");
  70.     else if (oneChar=='2')        StoreString("\p..---");
  71.     else if (oneChar=='3')        StoreString("\p...--");
  72.     else if (oneChar=='4')        StoreString("\p....-");
  73.     else if (oneChar=='5')        StoreString("\p.....");
  74.     else if (oneChar=='6')        StoreString("\p-....");
  75.     else if (oneChar=='7')        StoreString("\p--...");
  76.     else if (oneChar=='8')        StoreString("\p---..");
  77.     else if (oneChar=='9')        StoreString("\p----.");
  78.     
  79.     InputPlus(1);
  80. }
  81.